<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
<head>
<title>导航菜单</title>
<%@ include file="/WEB-INF/jsp/public/header.jspf" %>
<script language="JavaScript" src="${pageContext.request.contextPath}/script/menu.js"></script>
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/style/blue/menu.css" />
</head>
<body style="margin: 0">
<div id="Menu">
    <ul id="MenuUl">
    	<%--一级菜单 --%>
    	<!-- 对于一级和二级菜单，都需根据用户角色来判断，用户登录后在session存有该用户对象，也就可以取得其关联的role对象 -->
    	<!-- 每循环出一个权限对象，可以获得其URL/Name/id 要依次判断 -->
    	<s:iterator value="#application.topPriviledgeList">
    	<s:if test="#session.user.hasPriviledgeByName(name)">
	        <li class="level1">
	            <div onClick="$(this).next().toggle()" class="level1Style">
	            	<img src="${pageContext.request.contextPath}/style/images/MenuIcon/${id}.gif" class="Icon" />
	            	${name}
	            </div>
	            <ul style="display: none;" class="MenuLevel2">
	            	<%--二级菜单 --%>
	            	<!-- 对二级菜单也需要判断用户是否有权限 -->
	            	<s:iterator value="subPriviledges">
	            	<s:if test="#session.user.hasPriviledgeByName(name)">
		                <li class="level2">
		                    <div class="level2Style">
		                    	<img src="${pageContext.request.contextPath}/style/images/MenuIcon/menu_arrow_single.gif" /> 
		                    		<a href="${pageContext.request.contextPath}${url}.do" target="right">${name}</a>
		                    </div>
		                </li>
		            </s:if>
	           	 	</s:iterator>
	            </ul>
	        </li>
    	</s:if>
        </s:iterator>
    </ul>
</div>
</body>
</html>
